package com.template.web.utils;

import lombok.Data;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

@Data
public class PageResult<T> implements Serializable {

    private Integer page;
    private Integer size;
    private Integer total;
    private List<T> data;

    public PageResult(Long page, Long size, Long total, List<T> data) {
        this.page = page.intValue();
        this.size = size.intValue();
        this.total = total.intValue();
        this.data = data;
    }

    public static <T> PageResult<T> empty() {
        return new PageResult<>(1L, 20L, 0L, Collections.emptyList());
    }
}
